The following example illustrates the outofmemoryerror caused by the string substring method:
[Java] view plaincopyprint? Public class testgc {Private string large = new string (New char [2, 100000]);Public String getsubstring (){Return this. Large.
Introduction
Iterate through a string with a retractable window, with a time complexity of approximately o (n). Applies to "Finding the most small string of strings" that meet certain criteria.
Topics
Link
The substring of the substring that
/** Meaning: * For example, the longest duplicate substring in the string "s =" abcdsetseabcd "is ABCD, and the longest duplicate substring in the string" 4 S = "tmabcdefpiabcdef" is abcdef, the length is 6 S = "aaaaaaaa", the longest duplicate
Most of the content in this article is taken from the following two articles:
Http://blog.xebia.com/2007/10/04/leaking-memory-in-java /,
Http://www.iteye.com/topic/626801
Use an extreme example to illustrate the outofmemoryerror caused by the string
Want to know whether a string contains a specific substring. For example, you want to check whether an email address contains @. Problem
Want to know whether a string contains a specific substring. For example, you want to check whether an email
Problem
Want to know if a string contains a specific substring. For example, want to see if an email address contains an @.
Solve
if (Strpos ($_post[' email '), ' @ ') = = = False) { echo ' there is no @ in the e-mail address! ';}
Discuss
1. QuestionFind the longest palindrome stringGiven A string S, find the longest palindromic substring in S. The maximum length of S is assume, and there exists one unique longest palindromic substring.2. Solution2.1 O (N3)For each character, examine
Control Case
Task:Turns a string from uppercase to lowercase, or to a row.Solution:>>> A ='a'. Upper ()>>>a'A'>>> B ='b'. Lower ()>>>b'b'>>>Print "I Love PythOn". Capitalize () I love Python>>>Print "I Love PythOn". Title () I Love
Substr(PHP 4, PHP 5)
substr-returns a substring of a string
DescriptionString substr (string $string, int $start [, int $length])Returns a substring string string that is specified by the start and length arguments.
Parameters
String
The input
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.